package com.example.dto;

import lombok.Setter;

import java.io.Serializable;

@Setter
public abstract class SearchBasePage implements Serializable {
    /**
     * 默认页码
     */
    public static final Integer DEFAULT_PAGE = 1;
    /**
     * 默认每页数量
     */
    public static final Byte DEFAULT_PAGE_SIZE = 100;
    /**
     * 当前页码
     */
    private Integer current;
    /**
     * 每页数量  注意最多127
     */
    private Byte size;


    public Byte getSize() {
        return this.size != null && this.size >= 0 ? this.size : DEFAULT_PAGE_SIZE;
    }

    public Integer getCurrent() {
        return this.current != null && this.current >= 0 ? this.current : DEFAULT_PAGE;
    }


    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof SearchBasePage)) {
            return false;
        } else {
            SearchBasePage other = (SearchBasePage) o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label47:
                {
                    Object this$current = this.getCurrent();
                    Object other$current = other.getCurrent();
                    if (this$current == null) {
                        if (other$current == null) {
                            break label47;
                        }
                    } else if (this$current.equals(other$current)) {
                        break label47;
                    }

                    return false;
                }

                Object this$size = this.getSize();
                Object other$size = other.getSize();
                if (this$size == null) {
                    if (other$size != null) {
                        return false;
                    }
                } else if (!this$size.equals(other$size)) {
                    return false;
                }


                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof SearchBasePage;
    }

    public int hashCode() {

        int result = 1;
        Object $current = this.getCurrent();
        result = result * 59 + ($current == null ? 43 : $current.hashCode());
        Object $size = this.getSize();
        result = result * 59 + ($size == null ? 43 : $size.hashCode());
        return result;
    }

    public String toString() {
        return "SearchBasePage(current=" + this.getCurrent() + ", size=" + this.getSize() + ")";
    }

    public SearchBasePage() {
    }


}
